package com.situ.mall.common.service.impl;

import com.situ.mall.common.entity.Cart;
import com.situ.mall.common.entity.MemberAddress;
import com.situ.mall.common.mapper.CartMapper;
import com.situ.mall.common.service.ICartService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.situ.mall.common.vo.CartVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 闫佳宁
 * @since 2023-09-18
 */
@Service
public class CartServiceImpl extends ServiceImpl<CartMapper, Cart> implements ICartService {

    @Autowired
    private CartMapper cartMapper;


//    @Override
//    public void save(Integer productId, Integer number) {
//        cartMapper.save2(productId,number);
//    }

    @Override
    public List<CartVO> Cart(Integer memberId) {
        return cartMapper.select2(memberId);
    }

    @Override
    public void delete(Integer id) {
        baseMapper.delete(id);
    }

    @Override
    public void update(Integer id, Integer number) {
        cartMapper.update(id,number);
    }

    @Override
    public List<CartVO> selectProducts(String ids) {
        return cartMapper.select3(ids.split(","));
    }

    @Override
    public List<MemberAddress> selectAddress() {
        return cartMapper.select4();
    }

    @Override
    public List<CartVO> shoppingCart(Integer id) {
        return null;
    }


}
